﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Forum.DataAccess;
using Forum.DataAccess.DbModel;

namespace Forum.Domain.Managers
{
    public class ForumManager : ManagerBase
    {
        public ForumManager()
        {
            
        }

        public DataAccess.DbModel.SubForum GetForum(int id)
        {
            if (id == 0)
                throw new ArgumentException("Id is Guid.Empty");

            return (from p in DbContext.SubForums
                    where p.Id == id
                    select p).SingleOrDefault();
        }

        public void CreateForum(DataAccess.DbModel.SubForum forum)
        {
            DbContext.SubForums.AddObject(forum);
            DbContext.SaveChanges();
        }


    }
}
